#!/bin/bash

# postinst script for system-test-cryptotest
#
# see: dh_installdeb(1)

#set -e

# summary of how this script can be called:
#        * <postinst> \`configure' <most-recently-configured-version>
#        * <old-postinst> \`abort-upgrade' <new version>
#        * <conflictor's-postinst> \`abort-remove' \`in-favour' <package>
#          <new-version>
#        * <postinst> \`abort-remove'
#        * <deconfigured's-postinst> \`abort-deconfigure' \`in-favour'
#          <failed-install-package> <version> \`removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

PATH=/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH

if [ "${BASEDIR:=/}" = "/" ]; then
    BASEDIR=""
else
    BASEDIR_OPT="-b $BASEDIR"
fi

case "$1" in
    configure)
	chmod 0444 "$BASEDIR/opt/crypto-tests/README"
	chown root:bin "$BASEDIR/opt/crypto-tests/README"
	chmod 0444 "$BASEDIR/opt/crypto-tests/runfiles/default.run"
	chown root:bin "$BASEDIR/opt/crypto-tests/runfiles/default.run"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/MD5Msg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/MD5Msg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/README"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/README"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA1LongMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA1LongMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA1ShortMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA1ShortMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA224LongMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA224LongMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA224ShortMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA224ShortMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA256LongMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA256LongMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA256ShortMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA256ShortMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA384LongMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA384LongMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA384ShortMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA384ShortMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA512LongMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA512LongMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA512ShortMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA512ShortMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA512_224LongMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA512_224LongMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA512_224ShortMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA512_224ShortMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA512_256LongMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA512_256LongMsg.rsp"
	chmod 0444 "$BASEDIR/opt/crypto-tests/share/SHA512_256ShortMsg.rsp"
	chown root:bin "$BASEDIR/opt/crypto-tests/share/SHA512_256ShortMsg.rsp"
	chmod 0555 "$BASEDIR/opt/crypto-tests/bin/cryptotest"
	chown root:bin "$BASEDIR/opt/crypto-tests/bin/cryptotest"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/hmac/kcf/cleanup"
	chown root:bin "$BASEDIR/opt/crypto-tests/tests/hmac/kcf/cleanup"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/hmac/kcf/hmac_sha1_32"
	chown root:bin "$BASEDIR/opt/crypto-tests/tests/hmac/kcf/hmac_sha1_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/hmac/kcf/hmac_sha1_64"
	chown root:bin "$BASEDIR/opt/crypto-tests/tests/hmac/kcf/hmac_sha1_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/hmac/kcf/setup"
	chown root:bin "$BASEDIR/opt/crypto-tests/tests/hmac/kcf/setup"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/hmac/pkcs/hmac_sha1_32"
	chown root:bin "$BASEDIR/opt/crypto-tests/tests/hmac/pkcs/hmac_sha1_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/hmac/pkcs/hmac_sha1_64"
	chown root:bin "$BASEDIR/opt/crypto-tests/tests/hmac/pkcs/hmac_sha1_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_cbc_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_cbc_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_cbc_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_cbc_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ccm_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ccm_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ccm_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ccm_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_cmac_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_cmac_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_cmac_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_cmac_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ctr_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ctr_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ctr_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ctr_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ecb_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ecb_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ecb_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_ecb_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_gcm_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_gcm_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_gcm_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/aes_gcm_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/cleanup"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/cleanup"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/kcf/setup"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/kcf/setup"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cbc_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cbc_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cbc_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cbc_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cbc_pad_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cbc_pad_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cbc_pad_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cbc_pad_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ccm_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ccm_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ccm_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ccm_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cmac_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cmac_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cmac_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_cmac_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ctr_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ctr_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ctr_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ctr_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ecb_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ecb_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ecb_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_ecb_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_gcm_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_gcm_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_gcm_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/aes/pkcs/aes_gcm_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/cleanup"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/cleanup"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/md5_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/md5_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/md5_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/md5_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/setup"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/setup"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha1_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha1_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha1_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha1_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha256_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha256_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha256_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha256_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha384_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha384_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha384_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha384_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_224_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_224_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_224_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_224_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_256_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_256_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_256_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_256_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/kcf/sha512_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/md5_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/md5_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/md5_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/md5_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha1_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha1_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha1_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha1_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha256_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha256_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha256_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha256_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha384_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha384_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha384_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha384_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_224_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_224_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_224_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_224_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_256_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_256_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_256_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_256_64"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_32"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_32"
	chmod 0555 "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_64"
	chown root:root "$BASEDIR/opt/crypto-tests/tests/digest/pkcs/sha512_64"
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument '$1'" >&2
        exit 1
    ;;
esac



# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0

